from datetime import timedelta

def transferFilter(route, maxDelay=12*60): #Delay in minutes
    def filter(time1, time2):
        seconds2 = timedelta(days=0 if time2 > time1 else 1, hours=time2.hour, minutes=time2.minute).total_seconds()
        seconds1 = timedelta(days=0, hours=time1.hour, minutes=time1.minute).total_seconds()
        return (seconds2 - seconds1) / 60 < maxDelay
    if len([part for (index, part) in enumerate(route[1:]) if filter(route[index].destinationTime, route[index + 1].departureTime)]) < len(route) - 1:
        return None
    return route

